﻿using GDGeek;
using Microsoft.MixedReality.Toolkit.Input;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class Test2 : MonoBehaviour
{
    // Start is called before the first frame update
   
    public void debug() {

        Ray ray  = Camera.main.ViewportPointToRay(new Vector3(0.5f, 0.5f, 0));

        // Do a raycast

        //投射

        RaycastHit hit;

        if (Physics.Raycast(ray, out hit)) { 
            Debug.LogError("I'm looking at " + hit.transform.longName());
        }

    }
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(1)) {
            debug();
        }
        
    }
}
